package com.leen.user.controller;

import com.leen.common.vo.ResultEnum;
import com.leen.common.vo.ResultVO;
import com.leen.user.entity.YxUserLevel;
import com.leen.user.repository.YxUserLevelRepository;
import com.leen.user.service.YxUserLevelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户等级记录表接口
 */
@Api(tags = "用户等级记录表接口")
@RestController
@RequestMapping(value = "/yxuserlevel")
public class YxUserLevelController {

    @Autowired
    private YxUserLevelService yxUserLevelService;

    @ApiOperation(value = "新增数据")
    @PostMapping(value = "/yxuserlevel/add")
    public ResultVO<String> add(@RequestBody YxUserLevel yxUserLevel){
        YxUserLevel save = this.yxUserLevelService.save(yxUserLevel);
        return  save!=null? ResultVO.success(ResultEnum.DB_SUCCESS): ResultVO.failed(ResultEnum.DB_FAILED);
    }

    @ApiOperation(value = "修改数据")
    @PostMapping(value = "/yxuserlevel/update")
    public ResultVO<String> update(@RequestBody YxUserLevel yxUserLevel){
        YxUserLevel update = this.yxUserLevelService.save(yxUserLevel);
        return update!=null?ResultVO.success(ResultEnum.DB_SUCCESS):ResultVO.failed(ResultEnum.DB_FAILED);

    }

//    @ApiOperation(value ="删除数据" )
//    @GetMapping(value = "/yxuserlevel/delete")
//    public ResultVO<String>delete(Long id){
//        this.yxUserLevelService.deleteById(id);
//        return ResultVO.success(ResultEnum.DB_SUCCESS);
//    }
}
